package com.tbit.uqbike.service.business.impl;

import com.tbit.uqbike.object.pojo.ParkFeature;
import com.tbit.uqbike.service.business.ParkFeatureService;
import com.tbit.uqbike.webmanager.dao.core.ParkFeatureDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * 站点功能表(ParkFeature)表服务实现类
 *
 * @author jing
 * @since 2021-03-08 10:46:31
 */
@Service("parkFeatureService")
public class ParkFeatureServiceImpl implements ParkFeatureService {
    @Resource
    private ParkFeatureDao parkFeatureDao;

    /**
     * 通过ID查询单条数据
     *
     * @param parkFeature 主键
     * @return 实例对象
     */
    @Override
    public List<ParkFeature> queryById(ParkFeature parkFeature) {
        return this.parkFeatureDao.queryAll(parkFeature);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<ParkFeature> queryAllByLimit(int offset, int limit) {
        return this.parkFeatureDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param parkFeature 实例对象
     * @return 实例对象
     */
    @Override
    public ParkFeature insert(ParkFeature parkFeature) {
        parkFeature.setUpdateTime(new Date());
        this.parkFeatureDao.insert(parkFeature);
        return parkFeature;
    }

    /**
     * 修改数据
     *
     * @param parkFeature 实例对象
     * @return 实例对象
     */
    @Override
    public void update(ParkFeature parkFeature) {
        parkFeature.setUpdateTime(new Date());
        this.parkFeatureDao.update(parkFeature);
    }

    /**
     * 通过主键删除数据
     *
     * @param parkPointId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer parkPointId) {
        return this.parkFeatureDao.deleteById(parkPointId) > 0;
    }

    @Override
    public void delete(ParkFeature parkFeature) {
        parkFeatureDao.delete(parkFeature);
    }
}